package com.itheima.dao;

import com.itheima.domain.Account;
import org.apache.ibatis.annotations.*;

import java.util.List;
//添加测试信息++++++
public interface AccountDao {
    /* 查询所有账户信息 */
    //@Select("select * from account;")
    public List<Account> findAll();

    /* 添加一条账户记录 */
    @Insert("insert into account values(#{id},#{name},#{money})")
    public void addAccount(Account account);

    /* 根据name删除一条记录 */
    @Delete("delete from account where name = #{name}")
    public void delAccount(String accountName);

    /* 根据名称修改一条记录 */
    @Update("update account set money = #{money} where name = #{name}")
    public void updateAccount(Account account);

    /* 根据名称查询一条记录 */
    @Select("select * from account where name = #{name};")
    public Account findAccountByName(String accountName);

    /* 转账 */
    @Update("update account set money = money + #{money} where name = #{name}")
    public void transMoney(@Param("name") String accountName , @Param("money") Double money);

}
